/****************************************************
 * Description: Entity for 用户组角色
 * Copyright:   Copyright (c) 2013
 * Company:     beiwaionline
 * @author      bfsu
 * @version     1.0
 * @see
	HISTORY
    *  2013-08-08 bfsu Create File
**************************************************/

package com.bfsuolframework.security.entity;


import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.bfsuolframework.core.entity.Entity;
import com.bfsuolframework.core.entity.EntitySupport;

public class GroupRole extends EntitySupport implements Entity {

    private static final long serialVersionUID = 1L;

    public GroupRole(){}
    public GroupRole(Long id){
        this.id = id;
    }

    private Long id;
    private Group group;//用户组
    private Role role;//角色
    private Integer isDefault;//默认角色

    /**
     * @return 主键
     */
    public Long getId() {
        return id;
    }
    /**
     * @param 主键
     */
    public void setId(Long id) {
        this.id = id;
    }
    
    /**
     * @return 用户组
     */
    public Group getGroup() {
        return group;
    }
    
    /**
     * @param 用户组
     */
    public void setGroup(Group group) {
        this.group = group;
    }
    
    /**
     * @return 角色
     */
    public Role getRole() {
        return role;
    }
    
    /**
     * @param 角色
     */
    public void setRole(Role role) {
        this.role = role;
    }
    
    /**
     * @return 默认角色
     */
    public Integer getIsDefault() {
        return isDefault;
    }
    
    /**
     * @param 默认角色
     */
    public void setIsDefault(Integer isDefault) {
        this.isDefault = isDefault;
    }
    


    public int hashCode() {
        return new HashCodeBuilder().append("GroupRole").append(this.getId()).toHashCode();
    }

    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (getClass() != obj.getClass())
            return false;
        if (!(obj instanceof GroupRole))
            return false;
        final GroupRole that = (GroupRole)obj;
        return new EqualsBuilder().append(this.getId(), that.getId()).isEquals();
    }

    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).append("GroupRole").append("ID="+this.getId()).toString();
    }

}

